@include "misc.awk"

BEGIN { 
    test("no",            no(""))
    test("not no",        !no(2))
    test("the no",        the("",11)==11)
    test("the yes",       the(22,11)==22)
    seed(1); test("seed", f2s(0.5,rand())   == "0.23779")
    seed(1); test("any",  f2s(0.5,any(100)) == "23.77875")
    seed(1); test("anyi", anyi(100) == 24)
    test("round0",        round(0) == 0)
    test("roundPos1",     round(1.3) == 1)
    test("roundPos2",     round(1.7) == 2)
    test("roundNeg1",     round(-1.3) == -1)
    test("roundNeg2",     round(-1.7) == -2)
    s2as()
    sds()
    oos()
}
function s2as(     a) {
    s2a("name,tim,age,21,gender,m",a)
    test("s2a2s",a2s(a) == "age=21,name=tim,gender=m")
}
function sds(      a,db) {
    split("4,9,11,12,17,5,8,12,14",a,",")
    a2sd(a,db)
    test("sd",f2s(0.5,sd(db["sumSq"],db["sum"],db["n"]))=="4.17665")
}
function  oos(      a) {
    cat("bic",a)
    oo(a,"bic")
}
